home *** CD-ROM | disk | FTP | other *** search
/ The Whitby AMOS Club / Whitby AMOS Club 1.adf / WAC GAME / AJC-BRAINSHAVE.AMOS / AJC-BRAINSHAVE.amosSourceCode next >
AMOS Source Code  |  1978-01-29  |  22KB  |  931 lines

  1. '
  2. '  The Source Code For (pause for dramatic effect)...
  3. '
  4. '  "BRAINSHAVE" By Andrew Campbell 
  5. '
  6. '  A puzzler reviewed in Amiga Force, Amiga Power and even 
  7. '  mentioned in Amiga Format (ooooh! Woooow! Faaab! etc) 
  8. '
  9. '  Please feel free to steal what you like from this game, 
  10. '  including the music, graphics and sound fx (uncopyrighted)! 
  11. '
  12.  
  13. Dim MAPXY(20,16),DR(3),DEAD(50)
  14. Global MAPXY(),DR(),DEAD()
  15. Global ACROSS,DWN,FYRED
  16. Global XPOS,YPOS,X1,Y1,X,Y,DR,FREBOB,ANIBOB,EXTRABOB,EXB,XPLOSION$
  17. Global TGET,GOT,MOTION,BALLDR,CLOCK$,TL,LVL,F$,LVS,GRAVITY,EX,DEAD,EV,YA
  18. Global NTB,CONFUSION
  19. Global X,Y,X1,Y1,C,LVL,COUNT,SHOT,SFX,MUS
  20. SFX=0 : MUS=1
  21.  
  22. Dir$="Df0:BRAIN/"
  23.  
  24. BEGIN:
  25. If MUS=1 : SFX=0 : Erase 5 : End If 
  26. Track Loop On 
  27.  
  28. TSCREEN
  29. If MUS=1 : Track Stop : End If 
  30. If MUS=0 : SFX=1 : End If 
  31.  
  32. If DEAD=1 : DEAD=0 : Goto BEGIN : End If 
  33. Load "BOBS.BRAIN"
  34. If MUS=1 : Erase 5 : Track Load "MOD.BRAINACID",5 : End If 
  35. If SFX=1 : Erase 5 : Load "SAMS.BRAIN" : End If 
  36. Make Mask 
  37. For I=1 To 30 : Hot Spot I,0,0 : Next I
  38. Priority Reverse On 
  39. LVL=1 : LVS=5
  40.  
  41. RESTART:
  42. Auto View Off 
  43. Default Palette 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  44. Screen Open 1,320,16,8,Lowres : Curs Off : Flash Off : Cls 0 : Hide On 
  45. Screen Display 1,,284,,
  46. Screen Open 0,320,256,32,Lowres
  47. Screen To Front 1
  48. Curs Off : Flash Off : Hide On : Cls 0
  49. Auto View On : View 
  50. LMAP
  51. INIT
  52. Ink 1,0 : LIVES
  53. Double Buffer : Autoback 0 : BODRAW
  54. BALLDR=-1 : TL=130-(LVL*5)
  55. Screen 1
  56.  Ink 2
  57.  Bar 1,2 To 1+TL,14
  58. Fade 1,$0,$FFF,$F0,$80 : Wait 15 : Screen 0
  59. Fade 3 To -1,%11111111111111111111111111111110
  60. DR=3 : FYRED=-1 : FREBOB=13
  61. XPOS=10*16 : YPOS=6*16
  62. Bob 1,XPOS,YPOS,38
  63. For I=0 To 50 : DEAD(I)=0 : Next I
  64. Timer=0
  65. GOT=0
  66. If MUS=1 : Track Play 5 : End If 
  67.  
  68. MLOOP:
  69. K$=""
  70. Clear Key 
  71.  
  72. Do 
  73.  
  74.    K$=Inkey$
  75.  
  76.    XPOS=X Bob(1) : YPOS=Y Bob(1)
  77.    
  78.    If Jup(1) : DR=0 : MOOVE : End If 
  79.    If Jright(1) : DR=1 : MOOVE : End If 
  80.    If Jdown(1) : DR=2 : MOOVE : End If 
  81.    If Jleft(1) : DR=3 : MOOVE : End If 
  82.  
  83.    If Fire(1) : PICKUP : Bob 1,,,38 : End If 
  84.  
  85.    If TGET=GOT
  86.     If SFX=1 : Wait 20 : Sam Play 4 : Wait 70 : End If 
  87.     Fade 1 : Wait 20 : Inc LVL
  88.     If LVL>10 : Unpack 14 To 0 : Screen Close 1 : If MUS=1 : Track Stop : End If : Wait Key : Goto BEGIN : End If 
  89.     If MUS=1 : Track Stop : End If 
  90.     Goto RESTART
  91.    End If 
  92.  
  93.    If TL-Timer/50<0 or K$=" " or DEAD=1
  94.     For M=0 To 1
  95.     Screen M
  96.     A=$FFF : Fade 1,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
  97.     Wait 15
  98.     Next M
  99.     Screen Close 1
  100.     Screen 0 : FOUT : Dec LVS
  101.      If LVS=0 : Fade 1 : Wait 15 : If MUS=1 : Track Stop : End If : Goto BEGIN : End If 
  102.      DEAD=0 : If MUS=1 : Track Stop : End If : Goto RESTART
  103.    End If 
  104.  
  105.    If Scancode=69 : Fade 1 : Wait 15 : If MUS=1 : Track Stop : End If : Screen Close 1 : Goto BEGIN : End If 
  106.  
  107.    CLOCK
  108.    
  109. Loop 
  110.  
  111. '----------------
  112. 'THE PRO-SE-DURES
  113. '----------------
  114. Procedure INIT
  115.  
  116. For I=0 To 15 : Channel I To Bob I : Next I
  117.  
  118. XPLOSION$="A 1,(17,2)(18,2)(19,2)(20,2)(21,2)(22,2)(23,2)(42,2)"
  119.  
  120. CLOCK$="A 0,(30,5)(31,5)(32,5)(33,5)(34,5)(35,5)(36,5)(37,5)"
  121.  
  122. End Proc
  123. Procedure LMAP
  124.  
  125. If GRAVITY=0
  126.  F$="BRAINSHAVE/L"+Str$(LVL)-" "+".MAP"
  127. End If 
  128.  
  129. If GRAVITY=1
  130.  F$="BRAINSHAVE/L"+Str$(LVL)-" "+"G.MAP"
  131. End If 
  132.  
  133.  Open In 1,F$
  134.  
  135.  For DWN=0 To 15
  136.   For ACROSS=0 To 19
  137.    Input #1,A
  138.    MAPXY(ACROSS,DWN)=A
  139.   Next ACROSS
  140.  Next DWN
  141.  
  142.  Close 1
  143.  
  144.  FIN
  145.  
  146.  REDRAW
  147.  
  148. End Proc
  149. Procedure REDRAW
  150.  
  151.  For DWN=0 To 15
  152.   For ACROSS=0 To 19
  153.    MX=MAPXY(ACROSS,DWN)
  154.  
  155.    If MX>23 and MX<30 : Goto HELL : End If 
  156.  
  157.    If MX and MX<999
  158.     Ink 5 : Bar(ACROSS*16)+3,(DWN*16)+3 To(ACROSS*16+16)+3,(DWN*16+16)+3
  159.     Paste Bob ACROSS*16,DWN*16,MAPXY(ACROSS,DWN)
  160.    End If 
  161.  
  162.    HELL:
  163.   Next ACROSS
  164.  Next DWN
  165.  
  166. End Proc
  167. Procedure BODRAW
  168.  
  169.  
  170. EXTRABOB=16 : ANIBOB=3 : ENEMIES=0 : TGET=0
  171.  
  172.  For DWN=0 To 15
  173.   For ACROSS=0 To 19
  174.  
  175.     If MAPXY(ACROSS,DWN)>23 and MAPXY(ACROSS,DWN)<30
  176.      Bob EXTRABOB,ACROSS*16,DWN*16,MAPXY(ACROSS,DWN)
  177.      EXTRABOB
  178.      Inc TGET
  179.     End If 
  180.  
  181.   Next ACROSS
  182.  Next DWN
  183.  EXB=EXTRABOB
  184.  
  185. End Proc
  186. Procedure AROUND
  187.  
  188. '
  189. '    0 
  190. ' 3     1   <---------- The Surround System
  191. '    2 
  192. '
  193.  If X1<0 : X1=0 : End If 
  194.  If X1>19 : X1=19 : End If 
  195.  If Y1<0 : Y1=0 : End If 
  196.  If Y1>15 : Y1=15 : End If 
  197.  
  198.  DR(0)=MAPXY(X1,Y1-1)
  199.  DR(1)=MAPXY(X1+1,Y1)
  200.  DR(2)=MAPXY(X1,Y1+1)
  201.  DR(3)=MAPXY(X1-1,Y1)
  202.  
  203.  For I=0 To 3
  204.   If DR(I)<0 : DR(I)=0 : End If 
  205.  Next I
  206.  
  207. End Proc
  208. Procedure EXTRABOB
  209.  Inc EXTRABOB
  210.  If EXTRABOB>59
  211.   EXTRABOB=16
  212.  End If 
  213. End Proc
  214. Procedure FREBOB
  215.  Inc FREBOB
  216.  If SFX=1 : Sam Play 3 : End If 
  217.  If FREBOB>15
  218.   FREBOB=13
  219.  End If 
  220. End Proc
  221. Procedure MOOVE
  222.  
  223.  X1=XPOS/16 : Y1=YPOS/16
  224.  
  225.  If DR=3 and X1=0 or DR=2 and Y1=14 or DR=1 and X1=19 or DR=0 and Y1=0
  226.     Pop Proc
  227.  End If 
  228.  
  229.  If DR=0 : YPOS=YPOS-16 : End If 
  230.  If DR=1 : Add XPOS,16 : End If 
  231.  If DR=2 : Add YPOS,16 : End If 
  232.  If DR=3 : XPOS=XPOS-16 : End If 
  233.  
  234.  Wait Vbl 
  235.  Bob 1,XPOS,YPOS,38
  236.  Wait Vbl 
  237.  Wait Vbl 
  238.  
  239. End Proc
  240. Procedure PICKUP
  241.    
  242.    MX=MAPXY(XPOS/16,YPOS/16)
  243.    
  244.    If MX>23 and MX<30
  245.       Amal 1,"A 0,(38,10)(42,10)"
  246.       Amal On 1
  247.    End If 
  248.    
  249.    X1=XPOS/16 : Y1=YPOS/16
  250.    
  251.    For I=16 To EXB-1
  252.      If DEAD(I)=0 and I>15
  253.       If X Bob(I)=XPOS and Y Bob(I)=YPOS : EXTRABOB=I : Goto HELL : End If 
  254.      End If 
  255.    Next I
  256.    Amal Off(1)
  257.    Pop Proc
  258.    
  259.   HELL:
  260.  
  261.   MOTION=1
  262.    
  263.   Repeat 
  264.  
  265.    X1=XPOS/16 : Y1=YPOS/16
  266.       For I=16 To EXB-1
  267.         If DEAD(I)=0 and I>15
  268.          If X Bob(I)=XPOS and Y Bob(I)=YPOS : EXTRABOB=I : Goto HELLISH : End If 
  269.         End If 
  270.       Next I
  271.     MOTION=0
  272.     Amal Off(1)
  273.    Pop Proc
  274.  
  275.    HELLISH:
  276.  
  277.    If CONFUSION=1
  278.     If I Bob(EXTRABOB)<27 : GRAVITY=1 : End If 
  279.     If I Bob(EXTRABOB)>26 : GRAVITY=0 : End If 
  280.    End If 
  281.  
  282.    If GRAVITY=0
  283.       If BALLDR=-1
  284.          If Jup(1) : BALLDR=0 : If SFX=1 : Sam Play 1 : End If : SLIDE : End If 
  285.          If Jright(1) : BALLDR=1 : If SFX=1 : Sam Play 1 : End If : SLIDE : End If 
  286.          If Jdown(1) : BALLDR=2 : If SFX=1 : Sam Play 1 : End If : SLIDE : End If 
  287.          If Jleft(1) : BALLDR=3 : If SFX=1 : Sam Play 1 : End If : SLIDE : End If 
  288.       End If 
  289.    End If 
  290.  
  291.    If GRAVITY=1
  292.       If BALLDR=-1
  293.          If Jright(1) : BALLDR=1 : DROP : End If 
  294.          If Jleft(1) : BALLDR=3 : DROP : End If 
  295.       End If 
  296.    End If 
  297.  
  298.    CLOCK
  299.    If DEAD=1 : Pop Proc : End If 
  300.       
  301.   Until Fire(1)<>-1
  302.    
  303.   Amal Off(1)
  304.  
  305.   Bob 1,,,38
  306.    
  307. End Proc
  308. Procedure SLIDE
  309.    
  310.    HELL:
  311.  
  312.    If DEAD(EXTRABOB)>0 or EXTRABOB<16 : MOTION=0 : Pop Proc : End If 
  313.  
  314.    Channel 0 To Bob EXTRABOB
  315.    
  316.    X1=X Bob(1)/16 : Y1=Y Bob(1)/16
  317.    MAPXY(X1,Y1)=0
  318.    
  319.    AROUND
  320.    CLOCK
  321.    If DEAD=1 : Pop Proc : End If 
  322.  
  323.    DX=DR(BALLDR)
  324.    
  325.    For J=0 To 3
  326.       If I Bob(EXTRABOB)=DR(J)
  327.          For I=16 To EXB-1
  328.             If DEAD(I)=0
  329.               X=X Bob(I) : Y=Y Bob(I) : AJ=I Bob(I)
  330.             If AJ=I Bob(EXTRABOB)
  331.             If X=XPOS-16 and Y=YPOS or X=XPOS+16 and Y=YPOS or X=XPOS and Y=YPOS-16 or X=XPOS and Y=YPOS+16
  332.               YA=I
  333.               Bob Off(YA)
  334.               DEAD(YA)=1
  335.               Bob FREBOB,X,Y,42 : Amal FREBOB,XPLOSION$ : Amal On FREBOB
  336.               Inc GOT
  337.               FREBOB
  338.               MAPXY(X/16,Y/16)=0
  339.              End If 
  340.            End If 
  341.           End If 
  342.          Next I
  343.               Bob Off(EXTRABOB)
  344.               Bob FREBOB,XPOS,YPOS,42 : Amal FREBOB,XPLOSION$ : Amal On FREBOB
  345.               Inc GOT : FREBOB
  346.               MAPXY(XPOS/16,YPOS/16)=0
  347.               MOTION=0 : BALLDR=-1
  348.               DEAD(EXTRABOB)=1
  349.        Repeat : Until Fire(1)<>-1 : Pop Proc
  350.       End If 
  351.    Next J
  352.    
  353.    If DX>0 : BALLDR=-1 : If SFX=1 : Sam Play 2 : End If : MOTION=0 : MAPXY(X1,Y1)=I Bob(EXTRABOB) : Pop Proc : End If 
  354.    
  355.    If BALLDR=0
  356.       YPOS=YPOS-16
  357.    End If 
  358.    
  359.    If BALLDR=1
  360.       XPOS=XPOS+16
  361.    End If 
  362.    
  363.    If BALLDR=2
  364.       YPOS=YPOS+16
  365.    End If 
  366.    
  367.    If BALLDR=3
  368.       XPOS=XPOS-16
  369.    End If 
  370.    
  371.    Bob EXTRABOB,XPOS,YPOS,I Bob(EXTRABOB)
  372.    Bob 1,XPOS,YPOS,38
  373.    
  374.    X1=X Bob(1)/16 : Y1=Y Bob(1)/16
  375.    MAPXY(X1,Y1)=I Bob(EXTRABOB)
  376.    
  377.    Goto HELL
  378.    
  379. End Proc
  380. Procedure DROP
  381.  
  382.    MOVEME=1
  383.  
  384.    HELL:
  385.  
  386.    If DEAD(EXTRABOB)>0 or EXTRABOB<16 : MOTION=0 : Pop Proc : End If 
  387.  
  388.    Channel 0 To Bob EXTRABOB
  389.    
  390.    X1=X Bob(1)/16 : Y1=Y Bob(1)/16
  391.    MAPXY(X1,Y1)=0
  392.    
  393.    AROUND
  394.    CLOCK
  395.    If DEAD=1 : Pop Proc : End If 
  396.    
  397.    DX=DR(BALLDR)
  398.    
  399.    For J=0 To 3
  400.       If I Bob(EXTRABOB)=DR(J)
  401.          For I=16 To EXB-1
  402.             If DEAD(I)=0
  403.               X=X Bob(I) : Y=Y Bob(I) : AJ=I Bob(I)
  404.             If AJ=I Bob(EXTRABOB)
  405.             If X=XPOS-16 and Y=YPOS or X=XPOS+16 and Y=YPOS or X=XPOS and Y=YPOS-16 or X=XPOS and Y=YPOS+16
  406.               YA=I
  407.               X1=X Bob(YA)/16 : Y1=Y Bob(YA)/16
  408.               AROUND
  409.               Bob Off(YA)
  410.               DEAD(YA)=1
  411.               Bob FREBOB,X,Y,42 : Amal FREBOB,XPLOSION$ : Amal On FREBOB
  412.               Inc GOT
  413.               FREBOB
  414.               MAPXY(X/16,Y/16)=0
  415.  
  416.                If DR(0)>23 and DR(0)<30
  417.                  For V=16 To EXB-1
  418.                    If DEAD(V)=0 and V>15
  419.                       If X Bob(V)/16=X1 and Y Bob(V)/16=Y1-1
  420.                         EX=EXTRABOB
  421.                         EXTRABOB=V
  422.                         DROP_OTHERS
  423.                       End If 
  424.                      End If 
  425.                    Next V
  426.                  EXTRABOB=EX
  427.                End If 
  428.  
  429.                End If 
  430.               End If 
  431.              End If 
  432.          Next I
  433.               Bob Off(EXTRABOB)
  434.               Bob FREBOB,XPOS,YPOS,42 : Amal FREBOB,XPLOSION$ : Amal On FREBOB
  435.               Inc GOT : FREBOB
  436.               MAPXY(XPOS/16,YPOS/16)=0
  437.               MOTION=0 : BALLDR=-1
  438.               DEAD(EXTRABOB)=1
  439.            Pop Proc
  440.         End If 
  441.     Next J
  442.  
  443.  AROUND
  444.  If DX>0 : BALLDR=-1 : MOTION=0 : MAPXY(X1,Y1)=I Bob(EXTRABOB) : Pop Proc : End If 
  445.  
  446. If MOVEME=1
  447.  
  448.    If BALLDR=1
  449.       XPOS=XPOS+16
  450.    End If 
  451.    
  452.    If BALLDR=2
  453.       YPOS=YPOS+16
  454.    End If 
  455.    
  456.    If BALLDR=3
  457.       XPOS=XPOS-16
  458.    End If 
  459. End If 
  460.  
  461.    Wait Vbl 
  462.    Bob EXTRABOB,XPOS,YPOS,I Bob(EXTRABOB)
  463.    Bob 1,XPOS,YPOS,38
  464.    Wait Vbl 
  465.    
  466.    X5=X Bob(1)/16 : Y5=Y Bob(1)/16
  467.    MAPXY(X5,Y5)=I Bob(EXTRABOB)
  468.    EX=EXTRABOB
  469.  
  470.   If DR(0)>23 and DR(0)<30
  471.    I=0
  472.    For I=16 To EXB-1
  473.     If DEAD(I)=0 and I>15
  474.      If X Bob(I)/16=X1 and Y Bob(I)/16=Y1-1
  475.        EX=EXTRABOB
  476.        EXTRABOB=I
  477.        DROP_OTHERS
  478.      End If 
  479.     End If 
  480.    Next I
  481.    EXTRABOB=EX
  482.   End If 
  483.  
  484.    X1=X Bob(1)/16 : Y1=Y Bob(1)/16
  485.    AROUND
  486.  
  487.    If DR(2)=0 : BALLDR=2 : End If 
  488.    
  489.    If BALLDR=2 : Goto HELL : End If 
  490.  
  491.    If MOVEME=1 : MOVEME=0 : Goto HELL : End If 
  492.    BALLDR=-1 : MOTION=0
  493.  
  494. End Proc
  495. Procedure DROP_OTHERS
  496.  
  497.    MOVEME=1
  498.  
  499.    HELL:
  500.    
  501.    Channel 0 To Bob EXTRABOB
  502.    
  503.    X1=X Bob(EXTRABOB)/16 : Y1=Y Bob(EXTRABOB)/16
  504.    X2=X Bob(EXTRABOB) : Y2=Y Bob(EXTRABOB)
  505.    MAPXY(X1,Y1)=0
  506.    BALLDR=2
  507.    
  508.    AROUND
  509.    CLOCK
  510.    If DEAD=1 : Pop Proc : End If 
  511.  
  512.    DX=DR(2)
  513.    
  514.    For J=0 To 3
  515.       If I Bob(EXTRABOB)=DR(J)
  516.          For S=16 To EXB-1
  517.             If DEAD(S)=0
  518.               X=X Bob(S) : Y=Y Bob(S) : AJ=I Bob(S)
  519.             If AJ=I Bob(EXTRABOB)
  520.             If X=X2-16 and Y=Y2 or X=X2+16 and Y=Y2 or X=X2 and Y=Y2-16 or X=X2 and Y=Y2+16
  521.               YA=S
  522.               X1=X Bob(YA)/16 : Y1=Y Bob(YA)/16
  523.               AROUND
  524.               Bob Off(YA)
  525.               DEAD(YA)=1
  526.               Bob FREBOB,X,Y,42 : Amal FREBOB,XPLOSION$ : Amal On FREBOB
  527.               Inc GOT
  528.               FREBOB
  529.               MAPXY(X/16,Y/16)=0
  530.  
  531.             If NTB=0
  532.              If DR(0)>23 and DR(0)<30
  533.                  For Q=16 To EXB-1
  534.                    If DEAD(Q)=0 and Q>15
  535.                       If X Bob(Q)/16=X1 and Y Bob(Q)/16=Y1-1
  536.                         EV=EXTRABOB
  537.                         EXTRABOB=Q
  538.                         Goto HELL
  539.                         NTB=1
  540.                       End If 
  541.                      End If 
  542.                    Next Q
  543.                  EXTRABOB=EV
  544.                End If 
  545.               End If 
  546.  
  547.             End If 
  548.            End If 
  549.           End If 
  550.          Next S
  551.               Bob Off(EXTRABOB)
  552.               Bob FREBOB,X2,Y2,42 : Amal FREBOB,XPLOSION$ : Amal On FREBOB
  553.               Inc GOT : FREBOB
  554.               MAPXY(X2/16,Y2/16)=0
  555.               DEAD(EXTRABOB)=1
  556.               NTB=0
  557.        Pop Proc
  558.       End If 
  559.    Next J
  560.  
  561. If MOVEME=1
  562.  
  563.    If BALLDR=2
  564.       Y2=Y2+16
  565.    End If 
  566.  
  567. End If 
  568.  
  569.   Bob EXTRABOB,X2,Y2,I Bob(EXTRABOB)
  570.  
  571.   X7=X Bob(EXTRABOB)/16 : Y7=Y Bob(EXTRABOB)/16
  572.   MAPXY(X7,Y7)=I Bob(EXTRABOB)
  573.  
  574.   If DR(0)>23 and DR(0)<30
  575.    For Z=16 To EXB-1
  576.     If DEAD(Z)=0 and Z>15
  577.      If X Bob(Z)/16=X1 and Y Bob(Z)/16=Y1-1
  578.        EXTRABOB=Z
  579.        MOVEME=1
  580.        Goto HELL
  581.      End If 
  582.     End If 
  583.    Next Z
  584.   End If 
  585.  
  586.   X1=X Bob(EXTRABOB)/16 : Y1=Y Bob(EXTRABOB)/16
  587.  
  588.   AROUND
  589.  
  590.   If DR(2)=0 : BALLDR=2 : Goto HELL : End If 
  591.  
  592.   If MOVEME=1 : MOVEME=0 : Goto HELL : End If 
  593.  
  594.   NTB=0
  595.  
  596. End Proc
  597. Procedure CLOCK
  598.  
  599.  Screen 1
  600.  
  601.  Ink 3
  602.  Draw(1+TL-Timer/50),2 To(1+TL-Timer/50),14
  603.  If TL-Timer/50<0 : DEAD=1 : End If 
  604.  
  605.  Screen 0
  606.  
  607. End Proc
  608. Procedure LIVES
  609.  Screen 1
  610.  Ink 1,0
  611.  Paste Bob 250,0,38
  612.  Text 270,10,"x"+Str$(LVS)-" "
  613.  Screen 0
  614. End Proc
  615. Procedure TSCREEN
  616.  
  617.   GRAVITY=0 : CONFUSION=0
  618.  
  619.   Unpack 15 To 0
  620.   If MUS=1 : STILLHERE=1 : End If 
  621.  
  622.   SC$="B R A I N  S H A V E        | Written by Andrew Campbell using AMOS Professional and AMOS Professional Compiler by Europress Software.          How to play...                     "
  623.   SC$=SC$+"Brain Shave is the sequel to Enigma, a public domain game available on The Funhouse disk (along with Thundertron and Imagine Slideshow 2) and in the incredible Assassin's collection.          Those of you who have played Enigma (or"
  624.   SC$=SC$+" White Rabbits) will find this concept frighteningly easy to get to grips with.       The object of the game is to match up all the coloured tiles by dragging them around the screen using the joystick-controlled cursor.          "
  625.   SC$=SC$+" To pick up a tile and move it, simply press and hold fire down, then move the stick left/right/up/down and (if the block is free to move in that direction) you will be able to guide the blocks into collision.       Sounds a bit "
  626.   SC$=SC$+"complicated?      I assure you, this game dead simple.     Be warned that the EASY level contains a Zeus/Puzznik-style gravity system where the blocks will fall if they have nothing underneath them to support them!           "
  627.   SC$=SC$+"  Fans of Enigma (if there are any out there) will be pleased to know I have conjured up another nice collection of brain-teasters in a similar mould.      I hope you enjoy the special effects and the silly sound FX as well as "
  628.   SC$=SC$+"the game it's self.      If anyone has any comments or anything would they please write to me : AJC, 4 Alloe Field Place, Illingworth, Halifax, HX2 9ES  (okay, since you read the scroller this far - press F4 for a good laugh)         "
  629.   SC$=SC$+" You can be sure of a swift reply from me, even if you take the mickey out of my PD games!      Just write will you?          I'll send you some of my other PD games on request!                      Just time for a quick bit"
  630.   SC$=SC$+" of traditional scrolling greetings I suppose.        Best wishes go out to the following playtesters, associates and best friends :   Tony K, Keith M, Munaver K, Zaheer I, Jonathan C, Neale 'Doctor Roney' G, Graeme 'Professor' V, "
  631.   SC$=SC$+" Chris 'A1200' S, Chris 'the big one', Michelle F, Nicola B, Jason 'Mushroom' S, Maureen 'English Teacher' W (haha! Gotcha miss), Jenny 'I've vanished' B, Lee 'nutter' H, Paul S, Jeremy 'Warhammer 40,000' and millions more that I"
  632.   SC$=SC$+" just happened to forget.        Including you - the reader of this incredibly boring scrolly.   Haven't you anything better to do?          Lets wrap this bummer up shall we?           Here we go!                                      "
  633.  
  634.   Def Scroll 1,1,235 To 320,250,-2,0
  635.   CPOS=1
  636.   Set Text 2
  637.   Ink 1,0
  638.   Hide On 
  639.  
  640.  HEAVEN:
  641.  K$=""
  642.  Clear Key 
  643.  
  644.  Repeat 
  645.   K$=Inkey$
  646.  For I=1 To 2
  647.   Wait Vbl 
  648.   Scroll 1
  649.  Next I
  650.   Add PC,4
  651.    If PC>5
  652.     E$=Mid$(SC$,CPOS,1)
  653.     If E$="|" : Wait 50 : Else Ink 16,0 : Text 312,246,E$ : Ink 1,0 : Text 309,241,E$ : End If 
  654.     PC=0
  655.     Inc CPOS
  656.     If CPOS>Len(SC$) : CPOS=1 : End If 
  657.    End If 
  658.  Until K$<>""
  659.  
  660.  SC=Scancode
  661.  
  662.  If Upper$(K$)="M" and MUS=1 : MUS=0 : STILLHERE=1 : Track Stop : Goto HEAVEN : End If 
  663.  If Upper$(K$)="M" and MUS=0
  664.  If STILLHERE=0
  665.   SFX=0 : Erase 5 : Track Load "FH1:MOD.BRAININTRO",5
  666.  End If 
  667.   MUS=1 : Track Play 5 : Goto HEAVEN
  668.  End If 
  669.  
  670.  
  671.  If SC=95 : HELP : Clear Key : End If 
  672.  If SC=80 : GRAVITY=1 : Goto HELL : End If 
  673.  If SC=81 : GRAVITY=0 : Goto HELL : End If 
  674.  If SC=83 : DEMOLITION : DEAD=1 : Pop Proc : End If 
  675.  If SC=84 : Shift Up 5,0,1,1 : End If 
  676.  If SC=69 : Edit : End If 
  677.  
  678.  Goto HEAVEN
  679.  
  680.  HELL:
  681.  A=$FFF
  682.  Fade 1,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
  683.  Wait 15
  684.  FOUT
  685.  
  686. End Proc
  687. Procedure FIN
  688.  
  689.  A=$FFF
  690.  Fade 4,0,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
  691.  Ink 4
  692.  For I=130 To 0 Step -1
  693.   Box I,I To 320-I,256-I
  694.  Next I
  695.  
  696. End Proc
  697. Procedure FOUT
  698.  
  699.    For J=1 To 7
  700.     Bob Off 
  701.     Cls 2
  702.     Screen Swap 
  703.    Next J
  704.  
  705.     Fade 1,$0
  706.     Wait 15
  707.     Ink 0
  708.     Fade 7
  709.  
  710.    For I=0 To 140
  711.     Box I,I To 320-I,256-I : Screen Swap 
  712.     Box I,I To 320-I,256-I
  713.    Next I
  714.  
  715. End Proc
  716. Procedure HELP
  717.  
  718.  Screen Open 2,640,200,2,Hires
  719.  Curs Off : Cls 0
  720.  Colour 1,$FFF
  721.  Paper 0 : Pen 1
  722.  
  723.   Locate 0,2 : Centre "BRAIN SHAVE HELP SCREEN"
  724.   Locate 0,5 : Centre "For those of you having problems, here's a bit of help with colours "
  725.   Locate 0,6 : Centre "of blocks on the various levels. On the Gravity level, all blocks   "
  726.   Locate 0,7 : Centre "drop when there's nothing underneath them. On the Slider level, they"
  727.   Locate 0,8 : Centre "continue moving in one direction until they hit something.          "
  728.  
  729.  Locate 0,10 : Centre "Some levels require you to knock away three blocks at a time. This  "
  730.  Locate 0,11 : Centre "is the trickiest part of the game and demands logical thinking and  "
  731.  Locate 0,12 : Centre "fast reflexes. Be warned : if you match up two blocks of the same   "
  732.  Locate 0,13 : Centre "colour when there are three on the screen, you will be unable to do "
  733.  Locate 0,14 : Centre "the puzzle successfully. Oh, and there are 20 levels altogether.    "
  734.  
  735.  Locate 0,16 : Centre "And here are some keyboard options to help you : HELP - this screen."
  736.  Locate 0,17 : Centre "SPACE - Restart puzzle (and lose a life)   ESC - Quit current game."
  737.  
  738.  Locate 0,19 : Centre "There's also a hidden game accessable only from the title screen.   "
  739.  Locate 0,20 : Centre "Read the scroller for more information. Have fun....                "
  740.  Locate 0,23 : Centre "                                                              - AJC "
  741.  
  742.  Clear Key 
  743.  
  744.  K$=""
  745.  Repeat 
  746.  K$=Inkey$
  747.  Until Mouse Key or Fire(1) or K$<>""
  748.  
  749.  HELLO:
  750.  Screen Close 2
  751.  
  752. End Proc
  753. '----------------- 
  754. 'HIDDEN GAME! (press F4 on title screen... damn, gave it away!)
  755. '----------------- 
  756. Procedure DEMOLITION
  757.  
  758. If MUS=0 : SFX=1 : End If 
  759. If SFX=1 : Erase 5 : Load "SAMS.BRAIN" : End If 
  760.  
  761. DEAD=0
  762. Default Palette 0,$FFF,$F00,$F0,$F,$F0F,$FF0,$0,$0,$777,$666,$555,$444,$333,$222,$0
  763. Screen Open 0,320,200,2,Lowres : Curs Off : Flash Off : Cls 0
  764. '
  765. MAKEUP
  766. '
  767. Auto View Off 
  768. Screen Open 2,320,200,8,Lowres : Curs Off : Flash Off : Cls 0 : Hide On 
  769. Screen Open 0,320,400,8,Lowres : Curs Off : Flash Off : Cls 0 : Hide On 
  770. Colour 17,$FFF : Screen Display 0,,,,200
  771. '
  772. Dual Playfield 0,2
  773. '
  774. LVL=1
  775. '
  776.  Screen 2
  777.  For I=1 To 250 : Circle Rnd(319),Rnd(199),Rnd(9)+1 : Next I
  778.  Def Scroll 2,0,0 To 320,200,0,1
  779.  Screen 0
  780.  Def Scroll 1,0,0 To 320,400,0,-10
  781.  Auto View On : View 
  782.  X=X Hard(150) : Y=Y Hard(7)
  783.  Sprite 0,X,Y,1 : Wait Vbl 
  784. '
  785. Auto View On : View 
  786.  
  787. RESTART:
  788.  
  789.  SHOT=0
  790.  COUNT=0
  791.  MAKEWALL
  792.  Timer=0
  793.  
  794. MAIN:
  795.  Screen 2 : Scroll 2 : Screen Copy 2,0,198,320,199 To 2,0,0
  796.  
  797.  Screen 0
  798.  If Jleft(1) : X=X-3 : LIMITS : Sprite 0,X,Y,1 : End If 
  799. If Jright(1) : X=X+3 : LIMITS : Sprite 0,X,Y,1 : End If 
  800.   If Fire(1) and Chanmv(4)=0 : If SFX=1 : Sam Play 3 : End If : SHER : End If 
  801.  
  802.  If Timer>100-(LVL*10)
  803.   Scroll 1 : CHECK_TOP : Timer=0
  804.   If DEAD=1 : Pop Proc : End If 
  805.   If SFX=1 : Sam Play 1 : End If 
  806.  End If 
  807.  
  808.  If Chanmv(4)=-1
  809.   X1=X Screen(X Sprite(4)) : Y1=Y Screen(Y Sprite(4))
  810.   C=Point(X1,Y1)
  811.    If C>0 and C<8
  812.     Sprite Off(4)
  813.     WIPE_BLOCK
  814.    End If 
  815.  End If 
  816.  
  817.  If SHOT=COUNT : Inc LVL : Goto RESTART : End If 
  818.  
  819. Goto MAIN
  820.  
  821. End Proc
  822. Procedure MAKEUP
  823.  
  824. Auto View Off 
  825. Screen Open 1,320,50,16,Lowres : Curs Off : Flash Off : Cls 0 : Hide On 
  826.  
  827. '------- Make Control Bob
  828.  
  829. Ink 1 : Polygon 0,0 To 14,0 To 7,7
  830. Get Bob 1,1,0,0 To 16,16
  831. Hot Spot 1,7,7
  832. Cls 0
  833.  
  834. '------ Make Bullet Bob  
  835.  
  836. Ink 1 : Plot 0,0,1
  837. Get Bob 1,2,0,0 To 16,1
  838. Cls 0
  839.  
  840. Screen Close 1
  841.  
  842. End Proc
  843. Procedure LIMITS
  844.  If X>X Hard(319-7) : X=X Hard(319-7) : End If 
  845.  If X<X Hard(7) : X=X Hard(7) : End If 
  846. End Proc
  847. Procedure SHER
  848.  Sprite 4,X,Y,2
  849.  Amal 4,"M 0,200,20"
  850.  Amal On 4
  851. End Proc
  852. Procedure MAKEWALL
  853.  
  854.  Screen 0
  855.  
  856.   For I=0 To LVL*2
  857.    For J=0 To 19
  858.     Inc COUNT
  859.     Ink Rnd(4)+2
  860.     Bar J*16,200+(I*10) To(J*16)+16,200+(I*10)+10
  861.     Ink 7 : Box J*16+1,200+(I*10)+1 To(J*16)+16-1,200+(I*10)+10-1
  862.    Next J
  863.   Next I
  864.  
  865. End Proc
  866. Procedure WIPE_BLOCK
  867.  
  868.   Gosub WIPE
  869.  
  870.   LEFT=1 : RIGHT=1
  871.  
  872.   LX=X2*16 : LY=Y2*10 : RX=X2*16 : RY=Y2*10
  873.   LX=LX-8 : LY=LY+5 : RX=RX+24 : RY=RY+5
  874.  
  875.   If Point(LX,LY)=0 : LEFT=1 : End If 
  876.   If Point(RX,RY)=0 : RIGHT=1 : End If 
  877.   LX=LX+16 : RX=RX-16
  878.  
  879.   Repeat 
  880.  
  881.   If LEFT=1 : If Point(LX-16,LY)<8 and Point(LX-16,LY)>0 : LEFT=0 : End If : End If 
  882.  If RIGHT=1 : If Point(RX+16,RY)<8 and Point(RX+16,RY)>0 : RIGHT=0 : End If : End If 
  883.  
  884.  If LEFT=1
  885.    LX=LX-16 : LY=LY+10
  886.    C=Point(LX,LY)
  887.    If C=0 or C>7 or C=-1 : LEFT=0 : Else Gosub WIPE2 : End If 
  888.  End If 
  889.  
  890.  If RIGHT=1
  891.    RX=RX+16 : RY=RY+10
  892.    C=Point(RX,RY)
  893.    If C=0 or C>7 or C=-1 : RIGHT=0 : Else Gosub WIPE3 : End If 
  894.  End If 
  895.  
  896.   Until LEFT=0 and RIGHT=0
  897.  
  898.  Pop Proc
  899.  
  900.  
  901. WIPE:
  902.   X2=X1/16 : Y2=Y1/10 : Ink 0 : Bar X2*16,Y2*10 To X2*16+15,Y2*10+10 : Inc SHOT
  903.   If SFX=1 : Sam Play 2 : End If 
  904. Return 
  905.  
  906. WIPE2:
  907.   X2=LX/16 : Y2=LY/10 : Ink 0 : Bar X2*16,Y2*10 To X2*16+15,Y2*10+10 : Inc SHOT
  908.   If SFX=1 : Sam Play 2 : End If 
  909. Return 
  910.  
  911. WIPE3:
  912.   X2=RX/16 : Y2=RY/10 : Ink 0 : Bar X2*16,Y2*10 To X2*16+15,Y2*10+10 : Inc SHOT
  913.   If SFX=1 : Sam Play 2 : End If 
  914. Return 
  915.  
  916. End Proc
  917. Procedure CHECK_TOP
  918.  For I=2 To 319 Step 16
  919.   C=Point(I,5)
  920.   If C>0 and C<8
  921.    Paper 0 : Pen 1
  922.    Locate 0,12 : Centre "G A M E   O V E R"
  923.    Wait 50
  924.    DEAD=1
  925.    Pop Proc
  926.   End If 
  927.  Next I
  928. End Proc
  929. '----------------  
  930. 'THE END OF ALL! 
  931. '----------------